<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,minimum-scale=1.0,user-scalable=0" />
	<title>新闻资讯</title>
	<jsp:include page="../base/header.jsp"></jsp:include>
	<link rel="stylesheet" type="text/css" href="static/ssjf/css/news.css">
	<script type="text/javascript" src="static/ssjf/js/detail.js"></script>
</head>
<body style="background-image: url(static/ssjf/img/bg/bg_grey.png);">
	<div class="container" id="header" style="background-color: #f86941;">
		<div class="row title">
			<div class="col-1 col-sm-1" onclick="javascript:location.href='ssjf/index.html'"><img src="static/ssjf/img/symbol/back_arrow_w.png"></div>
			<div class="col-10 col-sm-10">新闻资讯</div>
			<div class="col-1 col-sm-1"><img src="static/ssjf/img/symbol/tab.png"></div>
		</div>
	</div>
	<div class="container">
		<div class="row">
			<div class="col-12 nav">
				<ul>
					<c:forEach var="col" items="${cols }" varStatus="vs">
						<c:if test="${vs.index == 0 }">
							<li class="nav-actived" value="${col.id }">${col.columnName }</li>
						</c:if>
						<c:if test="${vs.index != 0 }">
							<li value="${col.id }">${col.columnName }</li>
						</c:if>
					</c:forEach>
				</ul>
				<div class="clear"></div>
			</div>
		</div>
		<div class="row">
			<div class="col-12">
				<div id="slider" class="carousel slide" data-ride="carousel">
				  <ol class="carousel-indicators">
				    <li data-target="#slider" data-slide-to="0" class="active"></li>
				    <li data-target="#slider" data-slide-to="1"></li>
				    <li data-target="#slider" data-slide-to="2"></li>
				    <li data-target="#slider" data-slide-to="3"></li>
				    <li data-target="#slider" data-slide-to="4"></li>
				  </ol>
				  <div class="carousel-inner">
				    <div class="carousel-item active">
				      <img class="d-block w-100" src="static/ssjf/img/index/banner01.png" alt="First slide">
				      <div class="carousel-caption d-md-block">
					    <p>世界最年轻亿万富翁：从哈佛白手起家01</p>
					  </div>
				    </div>
				    <div class="carousel-item">
				      <img class="d-block w-100" src="static/ssjf/img/index/banner01.png" alt="Second slide">
				      <div class="carousel-caption d-md-block">
					    <p>世界最年轻亿万富翁：从哈佛白手起家02</p>
					  </div>
				    </div>
				    <div class="carousel-item">
				      <img class="d-block w-100" src="static/ssjf/img/index/banner01.png" alt="Second slide">
				      <div class="carousel-caption d-md-block">

					    <p>世界最年轻亿万富翁：从哈佛白手起家03</p>
					  </div>
				    </div>
				    <div class="carousel-item">
				      <img class="d-block w-100" src="static/ssjf/img/index/banner01.png" alt="Second slide">
				      <div class="carousel-caption d-md-block">
					    <p>世界最年轻亿万富翁：从哈佛白手起家04</p>
					  </div>
				    </div>
				    <div class="carousel-item">
				      <img class="d-block w-100" src="static/ssjf/img/index/banner01.png" alt="Second slide">
				      <div class="carousel-caption d-md-block">
					    <p>世界最年轻亿万富翁：从哈佛白手起家05</p>
					  </div>
				    </div>
				  </div>
				</div>
			</div>
		</div>
	</div>
	<div id="news-list" class="container">
	</div>
	<script>
	$(function(){
		$(".nav").find("li").click(function(){
			var val = $(this).attr("value");
			$.post("ssjf/news/info.dat",{columnId:val,pageNum:1,pageSize:6},function(result){
				result = eval("(" + result + ")");
				if(result.res == 1){
					var vals = result.obj.results;
					if(vals != null || vals.length > 0){
						$("#news-list").empty();
						var html = "";
						for(var i = 0; i < vals.length; i++){
							html += '<div class="row news_bar" value="'+vals[i].id+'">';
							html += '<div class="col-4 news_img"><img src="' + vals[i].cover + '"></div>';
							html += '<div class="col-8 news_content"><div class="row news_title">';
							html += '<div class="col-12">' + vals[i].title +'</div></div>';
							if(vals[i].content.length > 76) vals[i].content = vals[i].content.substring(0,30);
							html += '<div class="row news_detail"><div class="col-12">'+vals[i].content+'</div></div>';
							html += '<div class="row news_other"><div class="col-6">'+vals[i].publishTime+'</div>';
							html += '<div class="col-6">来源：'+vals[i].publisher+'</div></div></div></div>';
						}
						$("#news-list").append(html);
						$(".news_bar").click(function(){
							var id = $(this).attr("value");
							location.href = 'ssjf/page/news/detail.html?prevPage=ssjf/page/news.html&id='+id;
							
						});
					}
					
				}			
			});
		});
		$(".nav-actived").click();
	});
	
	</script>
</body>
</html>